//1.定义容器
import { defineStore } from "pinia";

export const useStore = defineStore("main", {
  state: () => {
    return {
      offsetWidth:
        document.documentElement.offsetWidth || document.body.offsetWidth,
      screenSize: "",
      selectedMenu: "/dashboard",
    };
  },
  getters: {},
  actions: {
    setOffsetWidth(offsetWidth: number) {
      this.offsetWidth = offsetWidth;
    },
    setSelectedMenu(selectedMenu: string) {
      this.selectedMenu = selectedMenu;
    },
  },
  // 开启数据缓存
  persist: {
    enabled: true
  }

});
